﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Yugi_Gui.Animation
{
    public class PlayStoryBoardSchedue : ISchedue
    {



        private Storyboard story;
        private Action complete;

        public PlayStoryBoardSchedue(Storyboard str)
        {
            this.story = str;
            this.story.Completed += new EventHandler(story_Completed);
        }

        void story_Completed(object sender, EventArgs e)
        {
            if (complete != null)
                complete();
        }

        #region ISchedue Members

        public void DoWork(Action complete)
        {
            this.complete = complete;
            if (this.story != null)
                this.story.Begin();

        }

        #endregion
    }
}
